<#include "top.ftl" >
<#include "manage_top.ftl">
<script type="text/javascript" src="ckeditor/ckeditor.js" ></script>
<script type="text/javascript" src="js/anime_edit.js" ></script>
<link rel="stylesheet" type="text/css" href="css/anime_edit.css"/>
<script>
$(function(){
	<#list anime.type as type>
		$("#${type.type_code}").attr("checked",true);
	</#list>
	$("#coverImg").attr("src","${coverPath}${anime.cover_url!'noCover.jpg'}");
	$("input[name='cover_url']").val("${anime.cover_url!'noCover.jpg'}");
	<!--CKEDITOR初始化-->
	CKEDITOR.replace('description');
	<!--CKEDITOR加载完毕后取值-->
	CKEDITOR.on('instanceReady', function (e) {
		CKEDITOR.instances.description.setData("${anime.description!}");
	});
	$("select[name='state'] option[value='${anime.state!}']").attr("selected",true);
})
function uploadSuccess(file, data, response)
{
	$("input[name='cover_url']").val(data);
	$("#coverImg").attr("src",'${coverPath}'+data);
}
</script>
<html>
	<body>
		<form id="animeEdit" method="post">
			<input type="hidden" id="id" name="id" value="${anime.id!}"/>
			<table class="akiba_table">
				<tr>
					<td colspan="2">
					<a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()">${i18n.getText("save")}</a>  
            		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="closeForm()">${i18n.getText("close")}</a>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("anime_code")}:
					</td>
					<td>
					<input name="code" class="easyui-validatebox" data-options="required:true" value="${anime.code!}"/>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("anime_name")}:
					</td>
					<td>
					<input name="name" class="easyui-validatebox" data-options="required:true" value="${anime.name!}"/>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("anime_type")}:
					</td>
					<td>
					<#list types! as type>
						<label><input id='${type.type_code}' type="checkbox" name="type" value='${type.type_code}'/>${i18n.getText(type.type_code)}</label>
					</#list>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("anime_state")}:
					</td>
					<td>
						<select name="state">
							<#list states as state>
								<option value="${state.dict_id}">${i18n.getText(state.dict_id)}</option>
							</#list>
						</select>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("anime_baike_url")}:
					</td>
					<td>
						<input name="baike_url" class="easyui-validatebox" value="${anime.baike_url!}"/>
					</td>
				</tr>
				<tr>
					<td>
					${i18n.getText("cv")}:
					</td>
					<td>
						<input id="cv">
					</td>
				</tr>
				<tr>
					<td>
					<input id="cover" type="file" name="coverfile"/>
					</td>
					<td>
					<img id="coverImg" class="cover"/>
					<input type="hidden" name="cover_url" value="${anime.cover_url!}"/>
					</td>
				</tr>
				<tr>
					<td colspan="2">
					<textarea id="description" name="description">
					</td>
				</tr>
			</table>
		</form>
	</body>
</html>